<template>
	<view class="container">
		<view class="banner">
			<image src="/static/images/index/guangao1.png" mode="scaleToFill" class="bg"></image>
			<view class="intro">
				<view class="greet">您好呀，{{ isLogin ? member.nickname : '游客' }}</view>
				<view class="note">内衣穿得舒适，女人才更自信。</view>
			</view>
		</view>
		<view class="content">
			<view class="entrance">
				<view class="item" @tap="pointsCheckIn">
					<image src="/static/images/index/签到 (1).png" class="icon"></image>
					<view class="title">积分签到</view>
				</view>
				<view class="item" @tap="merchantDelivery">
					<image src="/static/images/index/外卖单.png" class="icon"></image>
					<view class="title">商家配送</view>
				</view>
			</view>
			<view class="member-news">
				<view class="header">
					<view class="title">推荐商品</view>
					<view class="iconfont iconRightbutton"></view>
				</view>
				<view class="list">
					<view class="item">
						<image src="/static/images/index/8D7216B2183B1F4B1C8AFA1E6EF189D2.jpg"></image>
						<view class="title">精致内裤，诠释时尚态度</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapGetters
	} from 'vuex'

	export default {
		data() {
			return {}
		},
		computed: {
			...mapState(['member']),
			...mapGetters(['isLogin'])
		},
		methods: {
			//积分签到
			pointsCheckIn() {
				uni.navigateTo({
					url: "/packagesA/attendance/attendance"
				})
			},
			//商家配送
			merchantDelivery() {

				uni.switchTab({
					url: "/pages/menu/menu"
				})
			},

		}
	}
</script>

<style lang="scss" scoped>
	.banner {
		position: relative;
		width: 100%;
		height: 600rpx;

		.bg {
			width: 100%;
			height: 600rpx;
		}

		.intro {
			position: absolute;
			top: calc(50rpx + var(--status-bar-height));
			left: 40rpx;
			color: #FFFFFF;
			display: flex;
			flex-direction: column;

			.greet {
				font-size: $font-size-lg;
				margin-bottom: 10rpx;
			}

			.note {
				font-size: $font-size-sm;
			}
		}
	}

	.content {
		padding: 0 30rpx;
	}

	.entrance {
		position: relative;
		margin-top: -80rpx;
		margin-bottom: 30rpx;
		border-radius: 10rpx;
		background-color: #ffffff;
		box-shadow: $box-shadow;
		padding: 30rpx 0;
		display: flex;
		align-items: center;
		justify-content: center;

		.item {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			position: relative;

			&:nth-child(1):after {
				content: '';
				position: absolute;
				width: 1rpx;
				background-color: #ddd;
				right: 0;
				height: 100%;
				transform: scaleX(0.5) scaleY(0.8);
			}

			.icon {
				width: 84rpx;
				height: 84rpx;
				margin: 20rpx;
			}

			.title {
				font-size: 30rpx;
				color: $text-color-base;
				font-weight: 600;
			}
		}
	}

	.member-news {
		width: 100%;
		margin-bottom: 30rpx;

		.header {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx 0;

			.title {
				font-size: $font-size-lg;
				font-weight: bold;
			}

			.iconfont {
				font-size: 52rpx;
				color: $text-color-assist;
			}
		}

		.list {
			width: 100%;
			display: flex;
			flex-direction: column;

			.item {
				width: 100%;
				height: 240rpx;
				position: relative;

				image {
					width: 100%;
					height: 100%;
					border-radius: 8rpx;
				}

				.title {
					position: relative;
					font-size: 32rpx;
					font-weight: 500;
					width: 100%;
					top: -70rpx;
					left: 16rpx;
					color: #ffffff;
				}
			}
		}
	}
</style>